<template>
  <div class="container">
    <div>
      <p>说出你的想法！</p>
      <div>
        <!-- <el-upload
        class="upload-demo"
        drag
        action="/api/uploadComment"
        multiple
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip" >
          只能上传jpg/png文件，且不超过500mb
        </div>
      </el-upload> -->

        <!-- <el-radio-group v-model="labelPosition" size="small">
  <el-radio-button label="left">左对齐</el-radio-button>
  <el-radio-button label="right">右对齐</el-radio-button>
  <el-radio-button label="top">顶部对齐</el-radio-button>
</el-radio-group> -->
        <div style="margin: 20px"></div>
        <el-form
          :label-position="labelPosition"
          label-width="120px"
          :model="formLabelAlign"
        >
          <el-form-item label="建议">
            <el-input v-model="formLabelAlign.name"></el-input>
          </el-form-item>
          <el-form-item label="理由">
            <el-input v-model="formLabelAlign.region"></el-input>
          </el-form-item>
          <el-form-item label="赞同">
            <el-input v-model="formLabelAlign.type"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">提交</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div>
      <p>上传承诺书</p>
      <div class="zuobian">
        <el-upload class="upload-demo" drag action="/api/uploadcommit" multiple>
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
          <div class="el-upload__tip">只能上传jpg/png文件，且不超过500mb</div>
        </el-upload>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      stujob: [],
      hills: {},
      formLabelAlign: {
        name: "",
        region: "",
        type: "",
      },
    };
  },

  mounted() {
    axios.get("/api/liststuf").then((res) => {
      this.stujob = res.data;
    });
  },

  methods: {
    indexMethod(index) {
      return index + 1;
    },
    onSubmit() {
      console.log(this.formLabelAlign, 9999);
      axios
        .post("/api/uploadidea", {
          ...this.formLabelAlign
        })
        .then(
          (response) => {
            console.log("/a1", response.data);
          },
          (error) => {
            console.log("错误", error.message);
          }
        );
    },
  },
};
</script>

<style>
.container {
  margin: 0 6em;
  justify-content: space-between;
  display: flex;
  height: 20vh;
}
.zuobian {
  width: 50%;
}
</style>
